package me.obstsalat.guildera;

import java.util.TimerTask;

import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;

public class gt_villager_exp extends TimerTask {
	private guildera plugin;
	
	gt_villager_exp(guildera pl) {
		plugin = pl;
	}

	@Override
	public void run() {
		for(guild g : plugin.guilds) {
			for(Entity ent : plugin.overworld.getEntities()) {
				if(ent.getType() == EntityType.VILLAGER && g.isInGuild(ent.getLocation())) {
					int c = (int)Math.round(plugin.config.getDouble("villager_exp_ratio"));
					g.addEp(c);
				}
			}
		}
	}
}
